<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var arr = [
            {name:'电脑',price:999,num:10},
            {name:'手机',price:899,num:10},
            {name:'键盘',price:199,num:10},
            {name:'鼠标',price:99,num:10}
        ]
        var str = JSON.stringify(arr)
        console.log(str)
        var arr1 = JSON.parse(str)
        console.log(arr1)
    </script>
</body>
</html>